﻿using System;

namespace Borg
{
    [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
    public class TemplateAttribute : Attribute
    {
        private readonly ExtensionAttribute _attr = new ExtensionAttribute();

        public string OnReleasing
        {
            get { return _attr.OnReleasing; }
            set { _attr.OnReleasing = value; }
        }

        public string OnCreated
        {
            get { return _attr.OnCreated; }
            set { _attr.OnCreated = value; }
        }

        public string OnReleased
        {
            get { return _attr.OnReleased; }
            set { _attr.OnReleased = value; }
        }

        public bool Singleton
        {
            get { return _attr.Singleton; }
            set { _attr.Singleton = value; }
        }

        public bool AutoRelease
        {
            get { return _attr.AutoRelease; }
            set { _attr.AutoRelease = value; }
        }

        public string Name
        {
            get { return _attr.Name; }
            set { _attr.Name = value; }
        }

        public TemplateAttribute()
        {
            AutoRelease = true;
        }

        public TemplateAttribute(string name)
            : this()
        {
            Name = name;
        }

        public ExtensionAttribute ToExtensionAttribute()
        {
            return _attr;
        }
    }
}

